﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using DAL;
using BUS;
using Utility;
using System.Security.Cryptography;
using System.Text;
using System.Web.Security;
public partial class Admin_NhanVien_DoiMatKhau : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }
    protected void btn_Update_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] == null)
            Response.Redirect("NhanVien.aspx");
        string iD = Request.QueryString["id"];
        NhanVien nv = NhanVienBUS.GetById(iD);

        string Pass1 = FormsAuthentication.HashPasswordForStoringInConfigFile(txt_Password_NhanVien.Text, "SHA1");

        if (Pass1 == nv.MatKhau_NhanVien)
        {
            string Pass = FormsAuthentication.HashPasswordForStoringInConfigFile(txt_Pass_Moi.Text, "SHA1");
            nv.MatKhau_NhanVien = Pass;

            NhanVienBUS.UPDATE(nv);
            Response.Redirect("NhanVien.aspx");
        }
        else
        {
            lb_msg.Text = "Mật khẩu cũ sai. Mời bạn nhập lại";
        }
    }
}